package com.liuguang.gateway.config.mvc;

import com.liuguang.gateway.config.interceptor.LoginInterceptor;
import com.liuguang.gateway.config.interceptor.GetVerifyCodeTimeLimitInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName: MyWebMvcConfig
 * @Description：
 * @Author: wanghr
 * Date: 5:14 PM 2020/10/12
 * Version: 1.0
 */
@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {
    //    @Autowired
//    private LoginInterceptor loginInterceptor;

    @Autowired
    private GetVerifyCodeTimeLimitInterceptor getVerifyCodeTimeLimitInterceptor;

    //todo: 拓展：修改匹配路径，可以每个请求都进行请求次数限制
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //registry.addInterceptor(getVerifyCodeTimeLimitInterceptor).addPathPatterns("/api/user/getVerificationCode");
    }
}
